<?php
/**
 * GioCMS
 * 
 * LICENSE
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE Version 2 
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-2.0.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@ninhgio.com so we can send you a copy immediately.
 * 
 * @copyright	Copyright (c) 2010-2011 GioCMS (http://cms.ninhgio.com)
 * @license		http://www.gnu.org/licenses/gpl-2.0.txt GNU GENERAL PUBLIC LICENSE Version 2
 * @author		NinhGio - ninhgio@gmail.com
 * @since		1.0
 * @version		$Id:$
 */

$this->headTitle($this->TRANSLATOR->translator('cron_edit_page_title') . ' - ' . $this->TRANSLATOR->translator('common_admin_title', 'core'));
?>
<div class="content">
	<div class="box header mb0">
		<div class="head"><div></div></div>
		<h2 class="g_a_breadcump">
			<a class="fl" href="<?php echo $this->url('core_dashboard_index'); ?>"><?php echo $this->TRANSLATOR->translator('dashboard_breadcump', 'core'); ?></a>
			<small class="icon arrow_right" style="display: block;"></small>
			<a class="fl" href="<?php echo $this->url('news_article_list'); ?>"><?php echo $this->TRANSLATOR->translator('news_breadcump'); ?></a>
			<small class="icon arrow_right" style="display: block;"></small>
			<a class="fl" href="<?php echo $this->url('news_web_list'); ?>"><?php echo $this->TRANSLATOR->translator('web_breadcump'); ?></a>
			<small class="icon arrow_right" style="display: block;"></small>
			<a class="fl" href="<?php echo $this->url('news_cron_list', $this->web); ?>"><?php echo $this->TRANSLATOR->translator('cron_breadcump'); ?></a>
			<small class="icon arrow_right" style="display: block;"></small>
			<a class="fl" href="javascript: void(0);"><?php echo $this->TRANSLATOR->translator('cron_edit_breadcump'); ?></a>
			<div class="clear"></div>
		</h2>
	</div>
</div>
<div class="content">
	<div class="desc">
		<div class="body">
			<!--  -->
			<form action="<?php echo $this->url('news_cron_edit', $this->cronData); ?>" method="post" id="newsCronEdit">
				<h4 class="g_a_h4 fl"><?php echo $this->TRANSLATOR->translator('cron_edit_guide'); ?></h4>
				<div class="fr">
					<?php if ($this->ACL->isAllowed('edit', 'cron')) : ?>
					<a class="fl g_a_tip form_submit g_a_submit_button mr5" href="javascript: void(0);" title="<?php echo $this->STRING->escape($this->TRANSLATOR->translator('cron_button_save_title')); ?>"></a>
					<?php endif; ?>
					<a class="fl g_a_tip g_a_cancel_button mr5" href="javascript: history.go(-1);" title="<?php echo $this->STRING->escape($this->TRANSLATOR->translator('common_back_button', 'core')); ?>"></a>
					<?php if ($this->ACL->isAllowed('list', 'web')) : ?>
					<a class="fl g_a_tip" href="<?php echo $this->url('news_web_list'); ?>" title="<?php echo $this->STRING->escape($this->TRANSLATOR->translator('cron_actions_list_title')); ?>">
						<img src="<?php echo $this->APP_RESOURCE_SERVER; ?>/templates/<?php echo $this->APP_TEMPLATE; ?>/skins/<?php echo $this->APP_SKIN; ?>/images/actions_list_icon.png" style="padding: 0 5px 0 0;" />
					</a>
					<?php endif; ?>
				</div>
				<div class="g_a_line"></div>
				<p>
					<label for="simple_input"><?php echo $this->TRANSLATOR->translator('cron_name'); ?></label>
					<input title="<?php echo $this->STRING->escape($this->TRANSLATOR->translator('cron_name')); ?>" type="text" class="text w_20 g_a_tip_right" name="cron[name]" id="name" value="<?php if (isset($this->cronData['name'])) : ?><?php echo $this->cronData['name']; ?><?php endif; ?>" />
					<?php if (isset($this->errorMessages) && isset($this->errorMessages['name'])) : ?>
					<span class="g_a_error"><?php echo $this->TRANSLATOR->translator($this->errorMessages['name']); ?></span>
					<?php endif; ?>
					<br>
				</p>
				<p class="small">&nbsp;</p>
				<p>
					<label for="simple_input"><?php echo $this->TRANSLATOR->translator('cron_website_name'); ?></label>
					<select class="g_a_tip_right" id="website_name" name="cron[website_name]" title="<?php echo $this->STRING->escape($this->TRANSLATOR->translator('cron_website_name_description')); ?>">
						<?php if (isset($this->webs) && $this->webs) : ?>
						<?php foreach ($this->webs as $index => $web) : ?>
						<option value="<?php echo $web['web_id']; ?>"<?php if (isset($this->cronData['website_name']) && $this->cronData['website_name'] == $web['web_id']) : ?> selected="selected"<?php endif; ?>><?php echo $web['name']; ?></option>
						<?php endforeach; ?>
						<?php endif; ?>
					</select>
					<br>
				</p>
				<p class="small">&nbsp;</p>
				<p>
					<label for="simple_input"><?php echo $this->TRANSLATOR->translator('cron_website'); ?></label>
					<input title="<?php echo $this->STRING->escape($this->TRANSLATOR->translator('cron_website_description')); ?>" type="text" class="text w_20 g_a_tip_right" name="cron[website]" id="website" value="<?php if (isset($this->cronData['website'])) : ?><?php echo $this->cronData['website']; ?><?php endif; ?>" />
					<?php if (isset($this->errorMessages) && isset($this->errorMessages['website'])) : ?>
					<span class="g_a_error"><?php echo $this->TRANSLATOR->translator($this->errorMessages['website']); ?></span>
					<?php endif; ?>
					<br>
				</p>
				<p class="small">&nbsp;</p>
				<p>
					<label for="simple_input"><?php echo $this->TRANSLATOR->translator('cron_source'); ?></label>
					<input title="<?php echo $this->STRING->escape($this->TRANSLATOR->translator('cron_source_description')); ?>" type="text" class="text w_40 g_a_tip_right" name="cron[source]" id="source" value="<?php if (isset($this->cronData['source'])) : ?><?php echo $this->cronData['source']; ?><?php endif; ?>" />
					<?php if (isset($this->errorMessages) && isset($this->errorMessages['source'])) : ?>
					<span class="g_a_error"><?php echo $this->TRANSLATOR->translator($this->errorMessages['source']); ?></span>
					<?php endif; ?>
					<br>
				</p>
				<p class="small">&nbsp;</p>
				<p>
					<label for="simple_input"><?php echo $this->TRANSLATOR->translator('cron_category_main'); ?></label>
					<?php if (isset($this->errorMessages) && isset($this->errorMessages['main_category_id'])) : ?>
					<span class="g_a_error"><?php echo $this->TRANSLATOR->translator($this->errorMessages['main_category_id']); ?></span><br />
					<?php endif; ?>
					<div class="g_a_translatable">
						<?php echo Modules_Category_Services_Category::categorySelect(array(
																					'name'     => 'cron[main_category_id]', 
																					'id' 	   => 'main_category_id',
																					'selected' => (isset($this->cronData['main_category_id'])) ? $this->cronData['main_category_id'] : null), null,  'news'); ?>
					</div>					
					<br />
					<p style="font-size: 11px;"><?php echo $this->TRANSLATOR->translator('cron_category_select_multi'); ?></p>
					<div style="background: #fff; border: 1px solid #ccc; height: 200px; overflow: auto; width: 100%; font-size: 12px; color: #333;">
						<div class="g_a_translatable">
							<?php echo Modules_Category_Services_Category::categoryCheckbox(array(
																					'name' => 'categories[]', 
																					'id' => 'categories',
																					'selected' => (isset($this->categories) ? $this->categories : null)), null,  'news'); ?>
						</div>
					</div>
				</p>
				<p class="small">&nbsp;</p>
				<p>
					<label for="simple_input"><?php echo $this->TRANSLATOR->translator('cron_frequency'); ?></label>
					<input title="<?php echo $this->STRING->escape($this->TRANSLATOR->translator('cron_frequency_description')); ?>" type="text" class="text w_20 g_a_tip_right" name="cron[frequency]" id="frequency" value="<?php if (isset($this->cronData['frequency'])) : ?><?php echo $this->cronData['frequency']; ?><?php endif; ?>" />
					<?php if (isset($this->errorMessages) && isset($this->errorMessages['frequency'])) : ?>
					<span class="g_a_error"><?php echo $this->TRANSLATOR->translator($this->errorMessages['frequency']); ?></span>
					<?php endif; ?>
					<br>
				</p>
				<p class="small">&nbsp;</p>
				<p>
					<label for="simple_input"><?php echo $this->TRANSLATOR->translator('cron_priority'); ?></label>
					<select class="g_a_tip_right" id="priority" name="cron[priority]" title="<?php echo $this->STRING->escape($this->TRANSLATOR->translator('cron_priority_description')); ?>">
						<?php for ($i = 1; $i <= 100; $i++) : ?>
						<option value="<?php echo $i; ?>"<?php if (isset($this->cronData['priority']) && $this->cronData['priority'] == $i) : ?> selected="selected"<?php endif; ?>><?php echo $i; ?></option>
						<?php endfor; ?>
					</select>
					<br>
				</p>
				<p class="small">&nbsp;</p>
				<p>
					<label for="simple_input"><?php echo $this->TRANSLATOR->translator('cron_status'); ?></label>
					<select class="g_a_tip_right" id="status" name="cron[status]" title="<?php echo $this->STRING->escape($this->TRANSLATOR->translator('cron_status_description')); ?>">
						<option value="inactive"<?php if (isset($this->cronData) && $this->cronData['status'] == 'inactive') : ?> selected="selected"<?php endif; ?>><?php echo $this->TRANSLATOR->translator('cron_status_inactive'); ?></option>
						<option value="active"<?php if (isset($this->cronData) && $this->cronData['status'] == 'active') : ?> selected="selected"<?php endif; ?>><?php echo $this->TRANSLATOR->translator('cron_status_active'); ?></option>
					</select>
					<br>
				</p>
				<p class="small">&nbsp;</p>
				
				<p class="last buttons_demo">
					<?php if ($this->ACL->isAllowed('edit', 'cron')) : ?>
					<a class="button form_submit green" href="<?php echo $this->url('news_cron_edit', $this->cronData); ?>"><small class="icon check"></small><span><?php echo $this->TRANSLATOR->translator('common_submit_button', 'core'); ?></span></a>
					<?php endif; ?>
					<a class="button red" href="javascript: history.go(-1);"><small class="icon cross"></small><span><?php echo $this->TRANSLATOR->translator('common_back_button', 'core'); ?></span></a>
					<?php if (isset($this->tokenElement)) : ?><?php echo $this->tokenElement; ?><?php endif; ?>
				</p>
			</form>
			<!--  -->
			<div class="clear"></div>
		</div>
	</div>
	<div class="body_footer">
		<div class="bottom_left"><div class="bottom_right"></div></div>
	</div>
</div>
<?php if (($string = $this->MESSENGER->printMessages()) != null) : ?>
<script type="text/javascript">
Gio.Message.success('<?php echo $string; ?>');
</script>
<?php endif; ?>